﻿@model ZingBlog.Domain.Entities.ActionEntity
@{
    ViewBag.Title = "Add";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutForm.cshtml";
}

<div class="layui-col-md12 top10">
    <form class="layui-form" id="form" action="/Permissions/Action/Add" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">操作名称</label>
            <div class="layui-input-inline">
                <input name="ActionName" lay-verify="required" lay-vertype="tips" class="layui-input" type="text">
            </div>
            <label class="layui-form-label">操作编码</label>
            <div class="layui-input-inline">
                <input name="ActionCode" lay-verify="required" lay-vertype="tips" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">操作方法</label>
            <div class="layui-input-inline">
                <input name="Method" lay-vertype="tips" class="layui-input" type="text">
            </div>
            <label class="layui-form-label">排序号</label>
            <div class="layui-input-inline">
                <input name="OrderBy" lay-verify="required" lay-vertype="tips" class="layui-input" type="text" value="0">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">操作图片</label>
            <div class="layui-input-inline">
                <input name="Icon" id="Icon" lay-verify="required" lay-vertype="tips" class="layui-input" type="text" value="" />
            </div>
            <div class="layui-input-inline"><a id="sltIcon" href="javascript:;">选择图片</a><span id="spnIcon"></span></div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">操作样式</label>
            <div class="layui-input-inline">
                <input name="ClassName" lay-vertype="tips" class="layui-input" type="text">
            </div>
            <label class="layui-form-label">显示位置</label>
            <div class="layui-input-inline">
                @Html.DropDownListFor(model => model.Position, (List<SelectListItem>)ViewData["Position"], new Dictionary<string, object> { { "lay-filter", "Position" } })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">操作描述</label>
            <div class="layui-input-block">
                @Html.TextAreaFor(x => x.Remark, new Dictionary<string, object> { { "class", "layui-textarea" }, { "lay-verify", "pass" }, { "lay-vertype", "tips" } })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                @Html.StatusRadioHtml(true)
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="submitForm" id="submitForm">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        submitForm(form, "添加成功"); //监听提交
        $("#sltIcon").on("click", function () {
            openSetIcon();
        })
        form.on('select(Position)', function (data) {
            console.log(data.value); //得到被选中的值
            $("#Position").val(data.value);
            form.render('select');
        });
    });
</script>

